﻿<phone:PhoneApplicationPage 
    x:Class="BigPicWatcher.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:local="clr-namespace:BigPicWatcher" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    Style="{StaticResource mySystemTray}" OrientationChanged="PhoneApplicationPage_OrientationChanged">
    
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel 包含应用程序的名称和页标题-->
        
        <!--ContentPanel - 在此处放置其他内容-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,0,0,0">
            <Popup x:Name="pop_PageTitle" Width="480" Height="100" IsOpen="False" 
                   VerticalAlignment="Top">
                <TextBlock x:Name="PageTitle" Text="图片查看器" Margin="9,0,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
            </Popup>
            <Popup x:Name="pop_zoom" IsOpen="True" Height="110" Width="120"
                   VerticalAlignment="Center" HorizontalAlignment="Center">
                <Grid Name="g_zoom" Background="Gray" Opacity="0.7" HorizontalAlignment="Center">
                    <TextBlock Name="TB_zoom" Text="" FontSize="40" />
                </Grid>
            </Popup>
            <Popup x:Name="pop_zoomSet" IsOpen="False" Height="350" Width="385"
                   VerticalAlignment="Center" HorizontalAlignment="Center">
                <StackPanel Background="Gray" Opacity="0.9" HorizontalAlignment="Center">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="设置缩放率(%)" FontSize="28" VerticalAlignment="Center" />
                        <TextBox Name="TbZoomSet" Text="" Width="200" HorizontalAlignment="Center" GotFocus="TbZoomSet_GotFocus" LostFocus="TbZoomSet_LostFocus">
                            <TextBox.InputScope>
                                <InputScope>
                                    <InputScopeName NameValue="Number" />
                                </InputScope>
                            </TextBox.InputScope>
                        </TextBox>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="0,40,0,20">
                        <HyperlinkButton Name="BtnFull" Margin="20,0,0,0" FontSize="28" Content="原始比例" Click="BtnFull_Click" />
                        <HyperlinkButton Name="BtnScreenFit" Margin="60,0,0,0" FontSize="28" Content="适应屏幕" Click="BtnScreenFit_Click" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="0,20,0,40">
                        <HyperlinkButton Name="BtnWidthFit" Margin="20,0,0,0" FontSize="28" Content="适应宽度" Click="BtnWidthFit_Click" />
                        <HyperlinkButton Name="BtnHeightFit" Margin="60,0,0,0" FontSize="28" Content="适应高度" Click="BtnHeightFit_Click" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="0,0,0,40">
                        <HyperlinkButton Name="BtnLock" Margin="20,0,0,0" FontSize="28" Content="锁定屏幕方向" Click="BtnLock_Click" />
                    </StackPanel>
                </StackPanel>
            </Popup>
            <ScrollViewer Name="sv_main" HorizontalScrollBarVisibility="Auto">
                <Canvas Name="C_Pic" DoubleTap="C_Pic_DoubleTap" MouseEnter="C_Pic_MouseEnter">
                    <toolkit:GestureService.GestureListener>
                        <toolkit:GestureListener PinchStarted="GestureListener_PinchStarted" 
                                                 PinchDelta="GestureListener_PinchDelta" 
                                                 PinchCompleted="GestureListener_PinchCompleted"
                                                 Hold="GestureListener_Hold"/>
                    </toolkit:GestureService.GestureListener>
                    <Canvas.RenderTransform>
                        <CompositeTransform x:Name="translation"/>
                    </Canvas.RenderTransform>
                </Canvas>
            </ScrollViewer>
            <local:Loading Name="loadingScreen" Visibility="Visible" />
        </Grid>
        <Image Name="img_show" Visibility="Collapsed"></Image>
    </Grid>
        <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Icons/appbar.back.rest.png" Text="上一张"
                                            Click="Click_Previous"/>
            <shell:ApplicationBarIconButton IconUri="/Icons/pic_upload.png" Text="选择图片"
                                            Click="Click_OnCamera"/>
            <shell:ApplicationBarIconButton IconUri="/Icons/appbar.next.rest.png" Text="下一张"
                                            Click="Click_Next"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="切换到模式1" Click="Click_ToMode1"/>
                <shell:ApplicationBarMenuItem Text="输入缩放比例" Click="Click_SetZoom"/>
                <shell:ApplicationBarMenuItem Text="锁定屏幕方向" Click="Click_LockSrceen"/>
                <shell:ApplicationBarMenuItem Text="关于" Click="Click_About"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>